from django.contrib import admin

# Register your models here.

from .models import Task ,TaskDealer
from django.utils.safestring import mark_safe




class TaskAdmin(admin.ModelAdmin):
    readonly_fields = ('image_data',)  #必须加这行 否则访问编辑页面会报错
    def image_data(self, obj):
        return mark_safe(u'<img src="%s" width="100px" />' % obj.picture.url)
    # 页面显示的字段名称
    image_data.short_description = u'图片'

admin.site.register(Task,TaskAdmin)
admin.site.register(TaskDealer)
